%module(directors="1") thosttraderapi 

/* ========== 宏定义：将自定义指令映射到正确的 SWIG 指令 ========== */
%define %nodefaultcopy %nocopyctor %enddef

/* ========== 忽略所有类的赋值操作符 ========== */
%ignore *::operator=;

%{ 
#include "ThostFtdcTraderApi.h"
#include "./tools/iconv_wrapper.h"     
%}

/* ========== 1. 为 director 补虚析构，消除 Warning 514 ========== */
%feature("director") CThostFtdcTraderSpi;
%typemap(directorbase) CThostFtdcTraderSpi %{
    virtual ~CThostFtdcTraderSpi() {}
%}




/* ========== 6. 字符编码转换映射 ========== */
// 将 char[]/char[ANY] 的返回全部映射成 UTF-8 string
%typemap(out) char[ANY], char[] {
    $result = SWIG_FromCharPtrAndSize(
        gb2312_to_utf8($1).c_str(),
        gb2312_to_utf8($1).size()
    );
}

/* ========== 4. 入参 char** 和 char*[] 适配 Python3 list<str> ========== */
%typemap(in) char ** {
    if (!PyList_Check($input)) {
        PyErr_SetString(PyExc_TypeError, "Expected a list of strings");
        SWIG_fail;
    }
    
    int size = PyList_Size($input);
    $1 = (char **) malloc((size + 1) * sizeof(char *));
    
    for (int i = 0; i < size; i++) {
        PyObject *item = PyList_GetItem($input, i);
        if (!PyUnicode_Check(item)) {
            free($1);
            PyErr_SetString(PyExc_TypeError, "List items must be strings");
            SWIG_fail;
        }
        
        const char *str = PyUnicode_AsUTF8(item);
        if (!str) {
            free($1);
            SWIG_fail;
        }
        
        $1[i] = (char *) malloc((strlen(str) + 1) * sizeof(char));
        strcpy($1[i], str);
    }
    $1[size] = NULL;
}

%typemap(in) char *[] {
    if (!PyList_Check($input)) {
        PyErr_SetString(PyExc_TypeError, "Expected a list of strings");
        SWIG_fail;
    }
    
    int size = PyList_Size($input);
    $1 = (char **) malloc((size + 1) * sizeof(char *));
    
    for (int i = 0; i < size; i++) {
        PyObject *item = PyList_GetItem($input, i);
        if (!PyUnicode_Check(item)) {
            free($1);
            PyErr_SetString(PyExc_TypeError, "List items must be strings");
            SWIG_fail;
        }
        
        const char *str = PyUnicode_AsUTF8(item);
        if (!str) {
            free($1);
            SWIG_fail;
        }
        
        $1[i] = (char *) malloc((strlen(str) + 1) * sizeof(char));
        strcpy($1[i], str);
    }
    $1[size] = NULL;
}

%typemap(freearg) char ** {
    if ($1) {
        for (int i = 0; $1[i]; i++) {
            free($1[i]);
        }
        free($1);
    }
}

%typemap(freearg) char *[] {
    if ($1) {
        for (int i = 0; $1[i]; i++) {
            free($1[i]);
        }
        free($1);
    }
}



/* ========== 2. 忽略特定常量 ========== */
%ignore THOST_FTDC_VTC_BankBankToFuture;
%ignore THOST_FTDC_VTC_BankFutureToBank;
%ignore THOST_FTDC_VTC_FutureBankToFuture;
%ignore THOST_FTDC_VTC_FutureFutureToBank;
%ignore THOST_FTDC_FTC_BankLaunchBankToBroker;
%ignore THOST_FTDC_FTC_BrokerLaunchBankToBroker;
%ignore THOST_FTDC_FTC_BankLaunchBrokerToBank;
%ignore THOST_FTDC_FTC_BrokerLaunchBrokerToBank;

%include "cpointer.i"

/* ========== 3. 禁用指针包装类的默认拷贝，保证仅以指针语义传递 ========== */
%nodefaultcopy CThostFtdcRspAuthenticateFieldPtr;
%nodefaultcopy CThostFtdcRspInfoFieldPtr;
%nodefaultcopy CThostFtdcRspUserLoginFieldPtr;
%nodefaultcopy CThostFtdcUserLogoutFieldPtr;
%nodefaultcopy CThostFtdcUserPasswordUpdateFieldPtr;
%nodefaultcopy CThostFtdcTradingAccountPasswordUpdateFieldPtr;
%nodefaultcopy CThostFtdcRspUserAuthMethodFieldPtr;
%nodefaultcopy CThostFtdcRspGenUserCaptchaFieldPtr;
%nodefaultcopy CThostFtdcRspGenUserTextFieldPtr;
%nodefaultcopy CThostFtdcInputOrderFieldPtr;
%nodefaultcopy CThostFtdcParkedOrderFieldPtr;
%nodefaultcopy CThostFtdcParkedOrderActionFieldPtr;
%nodefaultcopy CThostFtdcInputOrderActionFieldPtr;
%nodefaultcopy CThostFtdcQryMaxOrderVolumeFieldPtr;
%nodefaultcopy CThostFtdcSettlementInfoConfirmFieldPtr;
%nodefaultcopy CThostFtdcRemoveParkedOrderFieldPtr;
%nodefaultcopy CThostFtdcRemoveParkedOrderActionFieldPtr;
%nodefaultcopy CThostFtdcInputExecOrderFieldPtr;
%nodefaultcopy CThostFtdcInputExecOrderActionFieldPtr;
%nodefaultcopy CThostFtdcInputForQuoteFieldPtr;
%nodefaultcopy CThostFtdcInputQuoteFieldPtr;
%nodefaultcopy CThostFtdcInputQuoteActionFieldPtr;
%nodefaultcopy CThostFtdcInputBatchOrderActionFieldPtr;
%nodefaultcopy CThostFtdcInputOptionSelfCloseFieldPtr;
%nodefaultcopy CThostFtdcInputOptionSelfCloseActionFieldPtr;
%nodefaultcopy CThostFtdcInputCombActionFieldPtr;
%nodefaultcopy CThostFtdcOrderFieldPtr;
%nodefaultcopy CThostFtdcTradeFieldPtr;
%nodefaultcopy CThostFtdcOrderActionFieldPtr;
%nodefaultcopy CThostFtdcInstrumentStatusFieldPtr;
%nodefaultcopy CThostFtdcBulletinFieldPtr;
%nodefaultcopy CThostFtdcTradingNoticeInfoFieldPtr;
%nodefaultcopy CThostFtdcErrorConditionalOrderFieldPtr;
%nodefaultcopy CThostFtdcExecOrderFieldPtr;
%nodefaultcopy CThostFtdcExecOrderActionFieldPtr;
%nodefaultcopy CThostFtdcForQuoteRspFieldPtr;
%nodefaultcopy CThostFtdcCFMMCTradingAccountTokenFieldPtr;
%nodefaultcopy CThostFtdcBatchOrderActionFieldPtr;
%nodefaultcopy CThostFtdcOptionSelfCloseFieldPtr;
%nodefaultcopy CThostFtdcQuoteFieldPtr;
%nodefaultcopy CThostFtdcQuoteActionFieldPtr;
%nodefaultcopy CThostFtdcCombActionFieldPtr;
%nodefaultcopy CThostFtdcContractBankFieldPtr;
%nodefaultcopy CThostFtdcTradingNoticeFieldPtr;
%nodefaultcopy CThostFtdcBrokerTradingParamsFieldPtr;
%nodefaultcopy CThostFtdcBrokerTradingAlgosFieldPtr;
%nodefaultcopy CThostFtdcQueryCFMMCTradingAccountTokenFieldPtr;
%nodefaultcopy CThostFtdcRspTransferFieldPtr;
%nodefaultcopy CThostFtdcRspRepealFieldPtr;
%nodefaultcopy CThostFtdcNotifyQueryAccountFieldPtr;
%nodefaultcopy CThostFtdcReqTransferFieldPtr;
%nodefaultcopy CThostFtdcReqRepealFieldPtr;
%nodefaultcopy CThostFtdcReqQueryAccountFieldPtr;
%nodefaultcopy CThostFtdcOpenAccountFieldPtr;
%nodefaultcopy CThostFtdcCancelAccountFieldPtr;
%nodefaultcopy CThostFtdcChangeAccountFieldPtr;
%nodefaultcopy CThostFtdcInstrumentFieldPtr;
%nodefaultcopy CThostFtdcCombPromotionParamFieldPtr;
%nodefaultcopy CThostFtdcRiskSettleInvstPositionFieldPtr;
%nodefaultcopy CThostFtdcRiskSettleProductStatusFieldPtr;
%nodefaultcopy CThostFtdcSPBMFutureParameterFieldPtr;
%nodefaultcopy CThostFtdcSPBMOptionParameterFieldPtr;
%nodefaultcopy CThostFtdcSPBMIntraParameterFieldPtr;
%nodefaultcopy CThostFtdcSPBMInterParameterFieldPtr;
%nodefaultcopy CThostFtdcSPBMPortfDefinitionFieldPtr;
%nodefaultcopy CThostFtdcSPBMInvestorPortfDefFieldPtr;
%nodefaultcopy CThostFtdcInvestorPortfMarginRatioFieldPtr;
%nodefaultcopy CThostFtdcInvestorProdSPBMDetailFieldPtr;
%nodefaultcopy CThostFtdcInvestorCommoditySPMMMarginFieldPtr;
%nodefaultcopy CThostFtdcInvestorCommodityGroupSPMMMarginFieldPtr;
%nodefaultcopy CThostFtdcSPMMInstParamFieldPtr;
%nodefaultcopy CThostFtdcSPMMProductParamFieldPtr;
%nodefaultcopy CThostFtdcSPBMAddOnInterParameterFieldPtr;
%nodefaultcopy CThostFtdcRCAMSCombProductInfoFieldPtr;
%nodefaultcopy CThostFtdcRCAMSInstrParameterFieldPtr;
%nodefaultcopy CThostFtdcRCAMSIntraParameterFieldPtr;
%nodefaultcopy CThostFtdcRCAMSInterParameterFieldPtr;
%nodefaultcopy CThostFtdcRCAMSShortOptAdjustParamFieldPtr;
%nodefaultcopy CThostFtdcRCAMSInvestorCombPositionFieldPtr;
%nodefaultcopy CThostFtdcInvestorProdRCAMSMarginFieldPtr;
%nodefaultcopy CThostFtdcRULEInstrParameterFieldPtr;
%nodefaultcopy CThostFtdcRULEIntraParameterFieldPtr;
%nodefaultcopy CThostFtdcRULEInterParameterFieldPtr;
%nodefaultcopy CThostFtdcInvestorProdRULEMarginFieldPtr;
%nodefaultcopy CThostFtdcInvestorPortfSettingFieldPtr;
%nodefaultcopy CThostFtdcInvestorInfoCommRecFieldPtr;
%nodefaultcopy CThostFtdcCombLegFieldPtr;
%nodefaultcopy CThostFtdcInputOffsetSettingFieldPtr;
%nodefaultcopy CThostFtdcOffsetSettingFieldPtr;
%nodefaultcopy CThostFtdcCancelOffsetSettingFieldPtr;
%nodefaultcopy CThostFtdcQryOrderFieldPtr;
%nodefaultcopy CThostFtdcQryTradeFieldPtr;
%nodefaultcopy CThostFtdcInvestorPositionFieldPtr;
%nodefaultcopy CThostFtdcTradingAccountFieldPtr;
%nodefaultcopy CThostFtdcInvestorFieldPtr;
%nodefaultcopy CThostFtdcTradingCodeFieldPtr;
%nodefaultcopy CThostFtdcInstrumentMarginRateFieldPtr;
%nodefaultcopy CThostFtdcInstrumentCommissionRateFieldPtr;
%nodefaultcopy CThostFtdcUserSessionFieldPtr;
%nodefaultcopy CThostFtdcExchangeFieldPtr;
%nodefaultcopy CThostFtdcProductFieldPtr;
%nodefaultcopy CThostFtdcDepthMarketDataFieldPtr;
%nodefaultcopy CThostFtdcTraderOfferFieldPtr;
%nodefaultcopy CThostFtdcSettlementInfoFieldPtr;
%nodefaultcopy CThostFtdcTransferBankFieldPtr;
%nodefaultcopy CThostFtdcInvestorPositionDetailFieldPtr;
%nodefaultcopy CThostFtdcNoticeFieldPtr;
%nodefaultcopy CThostFtdcInvestorPositionCombineDetailFieldPtr;
%nodefaultcopy CThostFtdcCFMMCTradingAccountKeyFieldPtr;
%nodefaultcopy CThostFtdcEWarrantOffsetFieldPtr;
%nodefaultcopy CThostFtdcInvestorProductGroupMarginFieldPtr;
%nodefaultcopy CThostFtdcExchangeMarginRateFieldPtr;
%nodefaultcopy CThostFtdcExchangeMarginRateAdjustFieldPtr;
%nodefaultcopy CThostFtdcExchangeRateFieldPtr;
%nodefaultcopy CThostFtdcSecAgentACIDMapFieldPtr;
%nodefaultcopy CThostFtdcProductExchRateFieldPtr;
%nodefaultcopy CThostFtdcProductGroupFieldPtr;
%nodefaultcopy CThostFtdcMMInstrumentCommissionRateFieldPtr;
%nodefaultcopy CThostFtdcMMOptionInstrCommRateFieldPtr;
%nodefaultcopy CThostFtdcInstrumentOrderCommRateFieldPtr;
%nodefaultcopy CThostFtdcSecAgentCheckModeFieldPtr;
%nodefaultcopy CThostFtdcSecAgentTradeInfoFieldPtr;
%nodefaultcopy CThostFtdcOptionInstrTradeCostFieldPtr;
%nodefaultcopy CThostFtdcOptionInstrCommRateFieldPtr;
%nodefaultcopy CThostFtdcInvestUnitFieldPtr;
%nodefaultcopy CThostFtdcCombInstrumentGuardFieldPtr;
%nodefaultcopy CThostFtdcTransferSerialFieldPtr;
%nodefaultcopy CThostFtdcAccountregisterFieldPtr;

/* ========== 4. TraderSpi 回调结构体指针采用 %pointer_class，确保传递指针 ========== */

/* ========== TraderSpi 回调结构体指针采�?%pointer_class，确保传递指�?========== */
%pointer_class(CThostFtdcRspAuthenticateField, CThostFtdcRspAuthenticateFieldPtr);
%pointer_class(CThostFtdcRspInfoField, CThostFtdcRspInfoFieldPtr);
%pointer_class(CThostFtdcRspUserLoginField, CThostFtdcRspUserLoginFieldPtr);
%pointer_class(CThostFtdcUserLogoutField, CThostFtdcUserLogoutFieldPtr);
%pointer_class(CThostFtdcUserPasswordUpdateField, CThostFtdcUserPasswordUpdateFieldPtr);
%pointer_class(CThostFtdcTradingAccountPasswordUpdateField, CThostFtdcTradingAccountPasswordUpdateFieldPtr);
%pointer_class(CThostFtdcRspUserAuthMethodField, CThostFtdcRspUserAuthMethodFieldPtr);
%pointer_class(CThostFtdcRspGenUserCaptchaField, CThostFtdcRspGenUserCaptchaFieldPtr);
%pointer_class(CThostFtdcRspGenUserTextField, CThostFtdcRspGenUserTextFieldPtr);
%pointer_class(CThostFtdcInputOrderField, CThostFtdcInputOrderFieldPtr);
%pointer_class(CThostFtdcParkedOrderField, CThostFtdcParkedOrderFieldPtr);
%pointer_class(CThostFtdcParkedOrderActionField, CThostFtdcParkedOrderActionFieldPtr);
%pointer_class(CThostFtdcInputOrderActionField, CThostFtdcInputOrderActionFieldPtr);
%pointer_class(CThostFtdcQryMaxOrderVolumeField, CThostFtdcQryMaxOrderVolumeFieldPtr);
%pointer_class(CThostFtdcSettlementInfoConfirmField, CThostFtdcSettlementInfoConfirmFieldPtr);
%pointer_class(CThostFtdcRemoveParkedOrderField, CThostFtdcRemoveParkedOrderFieldPtr);
%pointer_class(CThostFtdcRemoveParkedOrderActionField, CThostFtdcRemoveParkedOrderActionFieldPtr);
%pointer_class(CThostFtdcInputExecOrderField, CThostFtdcInputExecOrderFieldPtr);
%pointer_class(CThostFtdcInputExecOrderActionField, CThostFtdcInputExecOrderActionFieldPtr);
%pointer_class(CThostFtdcInputForQuoteField, CThostFtdcInputForQuoteFieldPtr);
%pointer_class(CThostFtdcInputQuoteField, CThostFtdcInputQuoteFieldPtr);
%pointer_class(CThostFtdcInputQuoteActionField, CThostFtdcInputQuoteActionFieldPtr);
%pointer_class(CThostFtdcInputBatchOrderActionField, CThostFtdcInputBatchOrderActionFieldPtr);
%pointer_class(CThostFtdcInputOptionSelfCloseField, CThostFtdcInputOptionSelfCloseFieldPtr);
%pointer_class(CThostFtdcInputOptionSelfCloseActionField, CThostFtdcInputOptionSelfCloseActionFieldPtr);
%pointer_class(CThostFtdcInputCombActionField, CThostFtdcInputCombActionFieldPtr);
%pointer_class(CThostFtdcOrderField, CThostFtdcOrderFieldPtr);
%pointer_class(CThostFtdcTradeField, CThostFtdcTradeFieldPtr);
%pointer_class(CThostFtdcOrderActionField, CThostFtdcOrderActionFieldPtr);
%pointer_class(CThostFtdcInstrumentStatusField, CThostFtdcInstrumentStatusFieldPtr);
%pointer_class(CThostFtdcBulletinField, CThostFtdcBulletinFieldPtr);
%pointer_class(CThostFtdcTradingNoticeInfoField, CThostFtdcTradingNoticeInfoFieldPtr);
%pointer_class(CThostFtdcErrorConditionalOrderField, CThostFtdcErrorConditionalOrderFieldPtr);
%pointer_class(CThostFtdcExecOrderField, CThostFtdcExecOrderFieldPtr);
%pointer_class(CThostFtdcExecOrderActionField, CThostFtdcExecOrderActionFieldPtr);
%pointer_class(CThostFtdcForQuoteRspField, CThostFtdcForQuoteRspFieldPtr);
%pointer_class(CThostFtdcCFMMCTradingAccountTokenField, CThostFtdcCFMMCTradingAccountTokenFieldPtr);
%pointer_class(CThostFtdcBatchOrderActionField, CThostFtdcBatchOrderActionFieldPtr);
%pointer_class(CThostFtdcOptionSelfCloseField, CThostFtdcOptionSelfCloseFieldPtr);
%pointer_class(CThostFtdcQuoteField, CThostFtdcQuoteFieldPtr);
%pointer_class(CThostFtdcQuoteActionField, CThostFtdcQuoteActionFieldPtr);
%pointer_class(CThostFtdcCombActionField, CThostFtdcCombActionFieldPtr);
%pointer_class(CThostFtdcContractBankField, CThostFtdcContractBankFieldPtr);
%pointer_class(CThostFtdcTradingNoticeField, CThostFtdcTradingNoticeFieldPtr);
%pointer_class(CThostFtdcBrokerTradingParamsField, CThostFtdcBrokerTradingParamsFieldPtr);
%pointer_class(CThostFtdcBrokerTradingAlgosField, CThostFtdcBrokerTradingAlgosFieldPtr);
%pointer_class(CThostFtdcQueryCFMMCTradingAccountTokenField, CThostFtdcQueryCFMMCTradingAccountTokenFieldPtr);
%pointer_class(CThostFtdcRspTransferField, CThostFtdcRspTransferFieldPtr);
%pointer_class(CThostFtdcRspRepealField, CThostFtdcRspRepealFieldPtr);
%pointer_class(CThostFtdcNotifyQueryAccountField, CThostFtdcNotifyQueryAccountFieldPtr);
%pointer_class(CThostFtdcReqTransferField, CThostFtdcReqTransferFieldPtr);
%pointer_class(CThostFtdcReqRepealField, CThostFtdcReqRepealFieldPtr);
%pointer_class(CThostFtdcReqQueryAccountField, CThostFtdcReqQueryAccountFieldPtr);
%pointer_class(CThostFtdcOpenAccountField, CThostFtdcOpenAccountFieldPtr);
%pointer_class(CThostFtdcCancelAccountField, CThostFtdcCancelAccountFieldPtr);
%pointer_class(CThostFtdcChangeAccountField, CThostFtdcChangeAccountFieldPtr);
%pointer_class(CThostFtdcInstrumentField, CThostFtdcInstrumentFieldPtr);
%pointer_class(CThostFtdcCombPromotionParamField, CThostFtdcCombPromotionParamFieldPtr);
%pointer_class(CThostFtdcRiskSettleInvstPositionField, CThostFtdcRiskSettleInvstPositionFieldPtr);
%pointer_class(CThostFtdcRiskSettleProductStatusField, CThostFtdcRiskSettleProductStatusFieldPtr);
%pointer_class(CThostFtdcSPBMFutureParameterField, CThostFtdcSPBMFutureParameterFieldPtr);
%pointer_class(CThostFtdcSPBMOptionParameterField, CThostFtdcSPBMOptionParameterFieldPtr);
%pointer_class(CThostFtdcSPBMIntraParameterField, CThostFtdcSPBMIntraParameterFieldPtr);
%pointer_class(CThostFtdcSPBMInterParameterField, CThostFtdcSPBMInterParameterFieldPtr);
%pointer_class(CThostFtdcSPBMPortfDefinitionField, CThostFtdcSPBMPortfDefinitionFieldPtr);
%pointer_class(CThostFtdcSPBMInvestorPortfDefField, CThostFtdcSPBMInvestorPortfDefFieldPtr);
%pointer_class(CThostFtdcInvestorPortfMarginRatioField, CThostFtdcInvestorPortfMarginRatioFieldPtr);
%pointer_class(CThostFtdcInvestorProdSPBMDetailField, CThostFtdcInvestorProdSPBMDetailFieldPtr);
%pointer_class(CThostFtdcInvestorCommoditySPMMMarginField, CThostFtdcInvestorCommoditySPMMMarginFieldPtr);
%pointer_class(CThostFtdcInvestorCommodityGroupSPMMMarginField, CThostFtdcInvestorCommodityGroupSPMMMarginFieldPtr);
%pointer_class(CThostFtdcSPMMInstParamField, CThostFtdcSPMMInstParamFieldPtr);
%pointer_class(CThostFtdcSPMMProductParamField, CThostFtdcSPMMProductParamFieldPtr);
%pointer_class(CThostFtdcSPBMAddOnInterParameterField, CThostFtdcSPBMAddOnInterParameterFieldPtr);
%pointer_class(CThostFtdcRCAMSCombProductInfoField, CThostFtdcRCAMSCombProductInfoFieldPtr);
%pointer_class(CThostFtdcRCAMSInstrParameterField, CThostFtdcRCAMSInstrParameterFieldPtr);
%pointer_class(CThostFtdcRCAMSIntraParameterField, CThostFtdcRCAMSIntraParameterFieldPtr);
%pointer_class(CThostFtdcRCAMSInterParameterField, CThostFtdcRCAMSInterParameterFieldPtr);
%pointer_class(CThostFtdcRCAMSShortOptAdjustParamField, CThostFtdcRCAMSShortOptAdjustParamFieldPtr);
%pointer_class(CThostFtdcRCAMSInvestorCombPositionField, CThostFtdcRCAMSInvestorCombPositionFieldPtr);
%pointer_class(CThostFtdcInvestorProdRCAMSMarginField, CThostFtdcInvestorProdRCAMSMarginFieldPtr);
%pointer_class(CThostFtdcRULEInstrParameterField, CThostFtdcRULEInstrParameterFieldPtr);
%pointer_class(CThostFtdcRULEIntraParameterField, CThostFtdcRULEIntraParameterFieldPtr);
%pointer_class(CThostFtdcRULEInterParameterField, CThostFtdcRULEInterParameterFieldPtr);
%pointer_class(CThostFtdcInvestorProdRULEMarginField, CThostFtdcInvestorProdRULEMarginFieldPtr);
%pointer_class(CThostFtdcInvestorPortfSettingField, CThostFtdcInvestorPortfSettingFieldPtr);
%pointer_class(CThostFtdcInvestorInfoCommRecField, CThostFtdcInvestorInfoCommRecFieldPtr);
%pointer_class(CThostFtdcCombLegField, CThostFtdcCombLegFieldPtr);
%pointer_class(CThostFtdcInputOffsetSettingField, CThostFtdcInputOffsetSettingFieldPtr);
%pointer_class(CThostFtdcOffsetSettingField, CThostFtdcOffsetSettingFieldPtr);
%pointer_class(CThostFtdcCancelOffsetSettingField, CThostFtdcCancelOffsetSettingFieldPtr);
%pointer_class(CThostFtdcQryOrderField, CThostFtdcQryOrderFieldPtr);
%pointer_class(CThostFtdcQryTradeField, CThostFtdcQryTradeFieldPtr);
%pointer_class(CThostFtdcInvestorPositionField, CThostFtdcInvestorPositionFieldPtr);
%pointer_class(CThostFtdcTradingAccountField, CThostFtdcTradingAccountFieldPtr);
%pointer_class(CThostFtdcInvestorField, CThostFtdcInvestorFieldPtr);
%pointer_class(CThostFtdcTradingCodeField, CThostFtdcTradingCodeFieldPtr);
%pointer_class(CThostFtdcInstrumentMarginRateField, CThostFtdcInstrumentMarginRateFieldPtr);
%pointer_class(CThostFtdcInstrumentCommissionRateField, CThostFtdcInstrumentCommissionRateFieldPtr);
%pointer_class(CThostFtdcUserSessionField, CThostFtdcUserSessionFieldPtr);
%pointer_class(CThostFtdcExchangeField, CThostFtdcExchangeFieldPtr);
%pointer_class(CThostFtdcProductField, CThostFtdcProductFieldPtr);
%pointer_class(CThostFtdcDepthMarketDataField, CThostFtdcDepthMarketDataFieldPtr);
%pointer_class(CThostFtdcTraderOfferField, CThostFtdcTraderOfferFieldPtr);
%pointer_class(CThostFtdcSettlementInfoField, CThostFtdcSettlementInfoFieldPtr);
%pointer_class(CThostFtdcTransferBankField, CThostFtdcTransferBankFieldPtr);
%pointer_class(CThostFtdcInvestorPositionDetailField, CThostFtdcInvestorPositionDetailFieldPtr);
%pointer_class(CThostFtdcNoticeField, CThostFtdcNoticeFieldPtr);
%pointer_class(CThostFtdcInvestorPositionCombineDetailField, CThostFtdcInvestorPositionCombineDetailFieldPtr);
%pointer_class(CThostFtdcCFMMCTradingAccountKeyField, CThostFtdcCFMMCTradingAccountKeyFieldPtr);
%pointer_class(CThostFtdcEWarrantOffsetField, CThostFtdcEWarrantOffsetFieldPtr);
%pointer_class(CThostFtdcInvestorProductGroupMarginField, CThostFtdcInvestorProductGroupMarginFieldPtr);
%pointer_class(CThostFtdcExchangeMarginRateField, CThostFtdcExchangeMarginRateFieldPtr);
%pointer_class(CThostFtdcExchangeMarginRateAdjustField, CThostFtdcExchangeMarginRateAdjustFieldPtr);
%pointer_class(CThostFtdcExchangeRateField, CThostFtdcExchangeRateFieldPtr);
%pointer_class(CThostFtdcSecAgentACIDMapField, CThostFtdcSecAgentACIDMapFieldPtr);
%pointer_class(CThostFtdcProductExchRateField, CThostFtdcProductExchRateFieldPtr);
%pointer_class(CThostFtdcProductGroupField, CThostFtdcProductGroupFieldPtr);
%pointer_class(CThostFtdcMMInstrumentCommissionRateField, CThostFtdcMMInstrumentCommissionRateFieldPtr);
%pointer_class(CThostFtdcMMOptionInstrCommRateField, CThostFtdcMMOptionInstrCommRateFieldPtr);
%pointer_class(CThostFtdcInstrumentOrderCommRateField, CThostFtdcInstrumentOrderCommRateFieldPtr);
%pointer_class(CThostFtdcSecAgentCheckModeField, CThostFtdcSecAgentCheckModeFieldPtr);
%pointer_class(CThostFtdcSecAgentTradeInfoField, CThostFtdcSecAgentTradeInfoFieldPtr);
%pointer_class(CThostFtdcOptionInstrTradeCostField, CThostFtdcOptionInstrTradeCostFieldPtr);
%pointer_class(CThostFtdcOptionInstrCommRateField, CThostFtdcOptionInstrCommRateFieldPtr);
%pointer_class(CThostFtdcInvestUnitField, CThostFtdcInvestUnitFieldPtr);
%pointer_class(CThostFtdcCombInstrumentGuardField, CThostFtdcCombInstrumentGuardFieldPtr);
%pointer_class(CThostFtdcTransferSerialField, CThostFtdcTransferSerialFieldPtr);
%pointer_class(CThostFtdcAccountregisterField, CThostFtdcAccountregisterFieldPtr);

/* ========== 5. 包含头文件，定义类型和结构体 ========== */
%include "ThostFtdcUserApiDataType.h"
%include "ThostFtdcUserApiStruct.h"
%include "ThostFtdcTraderApi.h"

